package com.controller;

import com.common.JSONPObjectUtil;
import com.common.ResultUtil;
import com.controller.base.BaseLocalController;
import com.entity.User;
import com.facade.user.r.IUserFacadeR;
import com.fasterxml.jackson.databind.util.JSONPObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;


@Controller
@RequestMapping("/user")
public class UserController extends BaseLocalController {

    @Resource
    private IUserFacadeR userFacadeR;

    @RequestMapping(value = "/query")
    @ResponseBody
    public JSONPObject query() {
        ResultUtil resultUtil = ResultUtil.newInstance();
        List<User> all = userFacadeR.findAll();
        resultUtil.setData(all);
        return JSONPObjectUtil.createJSONPObject(resultUtil);
    }

}
